<!DOCTYPE html>
<html lang="en">
	<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<meta charset="utf-8" />
	<title>用户登录</title>
    <link href="__PUBLIC__/Admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">   
    <link href="__PUBLIC__/Admin/css/style.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/login.min.css" rel="stylesheet">      
    <link href="__PUBLIC__/Admin/login/supersized.css" rel="stylesheet">

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>

<script src="http://static.geetest.com/static/tools/gt.js"></script>

    <style>
     
        .inp {
            border: 1px solid gray;
            padding: 0 10px;
            width: 200px;
            height: 30px;
            font-size: 18px;
        }
        
        #embed-captcha {
            width: 250px;
            margin: 0 auto;
        }
        .show {
            display: block;
        }
        .hide {
            display: none;
        }
        #notice {
            color: red;
        }
        /* 以下遮罩层为demo.用户可自行设计实现 */
        #mask {
            display: none;
            position: fixed;
            text-align: center;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            overflow: auto;
        }
        /* 可自行设计实现captcha的位置大小 */
        .popup-mobile {
            position: relative;
        }
        #popup-captcha-mobile {
            position: fixed;
            display: none;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            -webkit-transform: translate(-50%, -50%);
            z-index: 9999;
        }
    </style>

    <style type="text/css">
    	html { overflow-y: hidden; }
    </style>
	<script type="text/javascript">
        var url='__PUBLIC__';       
    </script>

	</head>
<body  style="font-size: 14px;">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-7">
                <div class="signin-info" style="color:#ffffff">
                    <div class="logopanel m-b">
                        <h1>[ 润龙集团 ]</h1>
                    </div>
                    <div class="m-b"></div>
                    <h3>欢迎使用润龙集团后台管理系统</h3>
                    <ul class="m-b">
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势一</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势二</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势三</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势四</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势五</li>
                    </ul>
                    <strong>还没有账号？ <a href="#" data-toggle="modal" data-target="#myModalreg">立即注册&raquo;</a></strong>

                </div>
            </div>

            <div class="col-sm-5" style="color:#ffffff">
                <form id="runlogin" name="runlogin" method="post" action="{:U('runlogin')}">
                    
                    <p class="m-t-md">润龙集团后台管理系统</p>
                    <input type="text" class="form-control uname" name="admin_username" id="admin_username" placeholder="用户名" />
                    <input type="password" class="form-control pword m-b" name="admin_pwd" id="admin_pwd" placeholder="密码" />
                   <!--  <input type="text" name="code" class="form-control pword" id="code" placeholder="验证码" oncontextmenu="return false" onpaste="return false"  style="width: 60%;" />
                        <img class="verifyimg reloadverify" alt="点击切换" src="{:U('verify')}" height="35px"; style="margin-top:-35px;width:80px;float:right;border:1px solid #cececf; " />
                    <br/> -->

                    <div id="embed-captcha"></div>
                    <p id="wait">正在加载验证码......</p>

                    <br/>
                    <a href="" data-toggle="modal" data-target="#forget">忘记密码了？</a>                
                    <button type="submit" class="btn btn-primary btn-block">登&nbsp;&nbsp;&nbsp;录</button>															
                </form>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left" style="color:#ffffff">
                润龙集团后台管理系统 Copyright © 2016
            </div>
        </div>
    </div>
 <script>
    var handlerEmbed = function (captchaObj) {
        $("#embed-submit").click(function (e) {
            var validate = captchaObj.getValidate();
            if (!validate) {
                $("#notice")[0].className = "show";
                setTimeout(function () {
                    $("#notice")[0].className = "hide";
                }, 2000);
                e.preventDefault();
            }
        });
        // 将验证码加到id为captcha的元素里
        captchaObj.appendTo("#embed-captcha");
        captchaObj.onReady(function () {
            $("#wait")[0].className = "hide";
        });
        // 更多接口参考：http://www.geetest.com/install/sections/idx-client-sdk.html
    };
    $.ajax({
        // 获取id，challenge，success（是否启用failback）
        url: "{:U('Admin/Login/getVerify',array('t'=>time()))}", // 加随机数防止缓存
        type: "get",
        dataType: "json",
        success: function (data) {
            // 使用initGeetest接口
            // 参数1：配置参数
            // 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件
            initGeetest({
                gt: data.gt,
                challenge: data.challenge,
                product: "float", // 产品形式，包括：float，embed，popup。注意只对PC版验证码有效
                offline: !data.success // 表示用户后台检测极验服务器是否宕机，一般不需要关注
            }, handlerEmbed);
        }
    });
</script>        
<!-- 注册 -->         
<div class="modal inmodal fade" id="myModalreg" tabindex="-1" role="dialog"  aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                	<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
                </button>
                <h4 class="modal-title">用户注册</h4>
            </div>
             <form class="form-horizontal" name="reg" id="reg" method="post" action="{:U('reg')}">
		        	<div class="ibox-content">
							<div class="form-group">
								<label class="col-sm-2 control-label">邮&nbsp;箱</label>
								<div class="col-sm-9">
									<input type="email" name="admin_email" id="admin_email" placeholder="输入邮箱" class="form-control"/>
								</div>
							</div>						
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">用户名</label>
								<div class="col-sm-9">
									<input type="text" name="admin_username" id="admin_usernamereg" placeholder="输入用户名" class="form-control"/>
								</div>
							</div>	
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">密&nbsp;码</label>
								<div class="col-sm-9">
									<input type="password" name="admin_pwd"  id="admin_pwdreg" placeholder="输入密码" class="form-control"/>
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">确认密码</label>
								<div class="col-sm-9">
									<input type="password" name="admin_newpwd"  id="admin_newpwdreg" placeholder="确认密码" class="form-control"/>
								</div>
							</div>					
						</div>
			        <div class="modal-footer">
			        	<button type="submit" class="btn btn-primary">提 交</button>
			            <button type="button" class="btn btn-danger" data-dismiss="modal">关 闭</button>		            
			        </div>
		        </form> 
		    </div>
        </div>
    </div>
</div>


<!-- 找回密码 -->
<div class="modal inmodal" id="forget" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                	<span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
                </button>
	                <i class="fa fa-laptop modal-icon"></i>
	                <h4 class="modal-title">找回密码</h4>
                </div>
                <form name="runemail" id="runemail" action="{:U('runemail')}" method="post">
	                <div class="modal-body">
	                    <div class="form-group">
	                    <label>Email</label> 
	                    <input type="email"  name="email" id="email" placeholder="输入您注册时候填写的邮箱" class="form-control"></div>
	                </div>
	                <div class="modal-footer">
	                    <button type="submit" class="btn btn-primary">提 交</button>
	                    <button type="button" class="btn btn-danger" data-dismiss="modal">关 闭</button>
	                </div>
                </form>
            </div>
        </div>
    </div>
</div>

    <script src="__PUBLIC__/Admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/Admin/login/supersized.3.2.7.min.js" ></script>
    <script src="__PUBLIC__/Admin/login/supersized-init.js" ></script>      
    <script src="__PUBLIC__/Admin/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/Admin/js/jquery.form.js"></script>
	<script src="__PUBLIC__/Common/layer/layer.js"></script>
	<!-- <script src="__PUBLIC__/Admin/js/content.min.js?v=1.0.0"></script> -->
	<script type="text/javascript">

    $(function(){
    $(".reloadverify").click(function(){
        changeverify();            
	    });      
	}) 

    function changeverify(){
    var verifyimg = $(".verifyimg").attr("src");
     if( verifyimg.indexOf('?')>0){
         $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
     }else{
         $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
    }
}

$(function(){
	$('#runlogin').ajaxForm({
		beforeSubmit: logcheckForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: logcomplete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function logcheckForm(){
		if( '' == $.trim($('#admin_username').val())){
			layer.msg('请输入登录用户名', {icon: 5,time:2000}, function(index){
 			layer.close(index);
			$('#member_list_email').focus(); 
			});
			return false;
		}
 
		if( '' == $.trim($('#admin_pwd').val())){
			layer.msg('请输入登录密码', {icon: 5,time:2000}, function(index){
 			layer.close(index);
			$('#member_list_email').focus(); 
			});
			return false;
		}

		// if( '' == $.trim($('#code').val())){
	 //       layer.msg('请输入验证码', {icon: 5,time:1000}, function(index){
	 //       layer.close(index);
	 //       $('#code').focus(); 
	 //       });
	 //       return false;
	 //    }

 }
	function logcomplete(data){
		if(data.status==1){
			layer.msg(data.info, {icon: 6,time:1000}, function(index){
 			layer.close(index);
			window.location.href="{:U('Index/index')}";
			});
		}else{
			layer.msg(data.info, {icon: 5,time:3000});
			$(".reloadverify").click();
			return false;	
		}

	}
 
});

//找回密码，发送邮件
$(function(){
	$('#runemail').ajaxForm({
		beforeSubmit: emailcheckForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: emailcomplete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function emailcheckForm(){
		if( '' == $.trim($('#email').val())){
			layer.alert('邮件不能为空', {icon: 5,time:3000});
			$('#email').focus(); 
			return false;
		}

 }
	function emailcomplete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6});
			return false;
		}else{
			layer.alert(data.info, {icon: 5,time:3000});
			return false;	
		}
	}
 
});


//注册AJAX方法
$(function(){
	$('#reg').ajaxForm({
		beforeSubmit: checkFormreg,
		success: complete,
		dataType: 'json'
	});
	
	function checkFormreg(){
		if( '' == $.trim($('#admin_email').val())){
			layer.alert('注册邮箱不能为空', {icon: 5,time:3000}, function(index){
 			layer.close(index);
			$('#admin_email').focus(); 
			});
			return false;
		}
		
		if( '' == $.trim($('#admin_usernamereg').val())){
			layer.alert('用户名不能为空', {icon: 5,time:3000}, function(index){
 			layer.close(index);
			$('#admin_usernamereg').focus(); 
			});
			return false;
		}

		if( '' == $.trim($('#admin_pwdreg').val())){
			layer.alert('密码不能为空', {icon: 5,time:3000}, function(index){
 			layer.close(index);
			$('#admin_pwdreg').focus(); 
			});
			return false;
		}
		
		if( '' == $.trim($('#admin_newpwdreg').val())){
			layer.alert('确认密码不能为空', {icon: 5,time:3000}, function(index){
 			layer.close(index);
			$('#admin_newpwdreg').focus(); 
			});
			return false;
		}

		if($.trim($('#admin_pwdreg').val()) != $.trim($('#admin_newpwdreg').val())){
			layer.alert('2次输入密码不同，请重新输入', {icon: 5,time:3000}, function(index){
 			layer.close(index);
			$('#admin_pwdreg').focus(); 
			});
			return false;
		}

 }
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			layer.alert(data.info, {icon: 5,time:3000});
			return false;	
		}
	}
 
});
</script>
</body>

</html>
